﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Hfm.Common.Entity.Industry;

namespace Hfm.Core.DataAccess.Industry
{
    public class IndustryData
    {
        protected readonly CoreContext Context;

        public IndustryData()
        {
            
        }

        public IndustryData(CoreContext context)
        {
            Context = context;
        }
        /// <summary>
        /// 查询所有行业
        /// </summary>
        /// <returns></returns>
        public virtual IList<IndustryEntity> GetIndustrys()
        {
            var query = from Ind in Context.IndustryEntities
                        select Ind;
            return query.ToList();
        }
        /// <summary>
        /// 根据Id查询Industry
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public virtual IndustryEntity GetIndustryName(int ID)
        {
            var query = from Ind in Context.IndustryEntities
                        where Ind.Id == ID 
                        select Ind;
            return query.SingleOrDefault();
        }
    }
}
